import request from '../utils/axios';

export function getCorrectionList(data) {
	return request({
		url: '/inspectionRectifyRegister/getInspectionRectifyRegisterList',
		method: 'get',
	    params:data
	});
}

export function addOrUpdateCorrection(data, forEdit) {
    if ( forEdit ) {
        return request({
            url: '/inspectionRectifyRegister/dealInspectionRectifyRegister',
            method: 'put',
            data
        });
    } else {
        return request({
            url: '/inspectionRectifyRegister/addInspectionRectifyRegister',
            method: 'post',
            data
        });
    }
}

export function setWorkOrder(data){
	let formData = new FormData();
	Object.keys(data).forEach(key=>{
		formData.append(key, data[key]);
	})
	return request({
		url: '/inspectionRectifyRegister/toWorkOrder',
		method: 'put',
		data:formData
	});
}
export function delCycle(data) {
	let formData = new FormData();
	Object.keys(data).forEach(key=>{
		formData.append(key, data[key]);
	})
	return request({
		url: '/inspectionCycle/delInspectionCycle',
		method: 'delete',
		data:formData
	});
}
// 工作日历
export function addWorkdayList(data){
	return request({
		url: '/workDaySetting/addWorkDaySetting',
		method: 'post',
		data
	});
}
export function getWorkdayList(data) {
	return request({
		url: '/workDaySetting/getWorkDaySettingList',
		method: 'get',
	    params:data
	});
}

// 获取维度属性
export function getFieldAttrs(data) {
	return request({
		url: '/field/getFieldAttrList',
		method: 'get',
	    params:data
	});
}
export function getAttrMachList(data) {
	return request({
		url: '/field/getFieldAttrEquipmentList',
		method: 'get',
	    params:data
	});
}


// 关联空间维度
export function getFieldList(data) {
	return request({
		url: '/field/getFiledList',
		method: 'get',
	    params:data
	});
}

export function getRelatedField(data) {
	return request({
		url: '/inspectionField/getInspectionField',
		method: 'get',
	    params:data
	});
}
export function saveRelatedField(data){
	let formData = new FormData();
	Object.keys(data).forEach(key=>{
		formData.append(key, data[key]);
	})
	return request({
		url: '/inspectionField/saveInspectionField',
		method: 'post',
		data:formData
	});
}


